#include <bits/stdc++.h>

using namespace std;

void gen(vector<string>& f, int n, int x, int y, int s) {
    if (n == 1) {
        f[x][y] = '#';
        f[x][y+2] = '#';
        f[x+1][y+1] = '#';
        f[x+2][y] = '#';
        f[x+2][y+2] = '#';
        return;
    }
    
    int ns = s / 3;
    
    gen(f, n-1, x, y, ns);
    gen(f, n-1, x, y + 2 * ns, ns);
    gen(f, n-1, x + ns, y + ns, ns);
    gen(f, n-1, x + 2 * ns, y, ns);
    gen(f, n-1, x + 2 * ns, y + 2 * ns, ns);
}

int main() {
    int n;
    cin >> n;
    
    int res = 1;
    for (int i = 0; i < n; i++) 
		res *= 3;
	int s = res;
    vector<string> f(s, string(s, ' '));
    
    gen(f, n, 0, 0, s);
    
    for (const string& r : f) cout << r << endl;
    
    return 0;
}
